<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="search">
    <div class="layui-row">
        <div class="layui-col-md3">
            <a href="/">
                logoCMS
            </a>
        </div>
        <div class="layui-col-md6">
            <form action="/search">
                <div class="layui-input-inline">
                    <input name="search" th:value="${search}" type="text" class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <button type="submit" class="layui-btn">搜索</button>
                </div>
            </form>

        </div>
        <div class="layui-col-md3">
            <a th:if="${session.loginUser == null}" href="/login">
                login
            </a>
            <a th:if="${session.loginUser}" href="/archives/index">我的文章</a>
            <a th:if="${session.loginUser}" href="/logout">退出</a>
        </div>
    </div>
</th:block>
<!-- 分页模块 -->
<th:block th:fragment="page">
    <div class="layui-row" th:if="${page.total > 0}">
        <div class="layui-col-sm6">
            <ul class="pagination list-page">
                <li class="page-item" th:if="${#pageUtil.isPrevious(page)}"><a class="page-link"
                    th:href="@{${#pageUtil.pageHref(page,page.current-1)}}">上一页</a>
                </li>
                <li th:class="'page-item'+ ${#pageUtil.pageActive(page, pageCode, 'active')}"
                    th:each="pageCode:${#pageUtil.pageCode(page)}">
                    <a class="page-link" th:if="${#pageUtil.isCode(pageCode)} ne true"
                       th:href="@{${#pageUtil.pageHref(page,pageCode)}}">[[${pageCode}]]</a>
                    <a class="page-link breviary" th:if="${#pageUtil.isCode(pageCode)}">…</a>
                </li>
                <li class="page-item" th:if="${#pageUtil.isNext(page)}"><a class="page-link"
                     th:href="@{${#pageUtil.pageHref(page,page.current+1)}}">下一页</a>
                </li>
            </ul>
        </div>
    </div>
</th:block>